home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 3_11.lha / 3_11 / 3_11dtst.c < prev    next >
Text File  |  1993-08-08  |  994b  |  48 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <stdio.h>
  6. include <setjmp.h>
  7. ifdef TSTD
  8. include "3_11d.c"
  9. endif
  10. ifdef TSTE
  11. include "3_11e.c"
  12. endif
  13.  
  14. nt x[] = {
  15. -2147483648, 0, 10, 100, 2147483647,
  16. -0, -10, -100, -2147483647,
  17. 0x0, 0x10, 0x100, 0x2147483647, 0x2147483648, 0x123abc,
  18. -0x0, -0x10, -0x100, -0x2147483647, -0x2147483648, -0x123abc,
  19. 0xFfFfFfFf, 0x7fffffff, 0x8000000,
  20. -0xFfFfFfFf, -0x7fffffff, -0x8000000,
  21. 00, 010, 0100, 017777777777, 037777777777, 020000000000,
  22. -00,-010, -0100, -017777777777, -037777777777, -020000000000,
  23. 017777777776, -017777777776,
  24. 1515
  25. ;
  26.  
  27. mp_buf jmpenv;
  28.  
  29. oid error(const char *x, ...)
  30.  
  31.    printf("error: %s\n", x);
  32.    longjmp(jmpenv, 1);
  33.  
  34.  
  35. ain()
  36.  
  37.    char buf[100];
  38.    for (int *xp = x; *xp != 1515; xp++)
  39. if (setjmp(jmpenv))
  40.     ;    // error occurred
  41. else
  42.     {
  43.     itoa(buf, sizeof(buf), *xp);
  44.     printf("*xp='%d', buf='%s'\n", *xp, buf);
  45.     }
  46.    return 0;
  47.  
  48.